package query;




import java.util.LinkedList;

import document.InvertedIndex;



public class AndNotOperand extends BinaryOperand 
{
	@Override
	public void processOperands(InvertedIndex i) 
	{
		queryResult = new LinkedList<Integer>();
		NotOperand notop = new NotOperand();
		AndOperand andop = new AndOperand();
		notop.putRightOperand(rightOperand);
		
		andop.putLeftOperand(leftOperand);
		andop.putRightOperand(notop);
		andop.process(i);
		queryResult = andop.getResult();
		
	}	
	
	@Override
	public String getName() {
		String name  = "";
		if(leftOperand!=null) {
			name += leftOperand.getName();
		}
		name += "and not";
		if(rightOperand!=null) {
			name += rightOperand.getName();
		}
		
		return name;
	}

	@Override
	public Query rebuildOptimal(InvertedIndex i) 
	{
		return this;
	}

	@Override
	public Query rebuildWorst(InvertedIndex i) {
		return this;
	}
}
